<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:apabb="http://apabb.org.br/jsf"
	template="../template/template.xhtml">

	<ui:define name="nucleoBase">
		<h:form id="formBem">

			<div style="position: relative; left: 11px; font-size: 120%;">
				<h2>Manter Requisicao</h2>
			</div>
			<hr size="3" style="left: 3px; background-color: #000080;" />


			<div id="pesquisaBem">

				<h:messages errorClass="erro" infoClass="info" showSummary="true" />

				<br />
				<fieldset styleClass="form"
					style="background-color: rgb(240, 250, 255)">

					<h:panelGrid columns="2" width="34%">
						
						
						<h:column>
							<h:outputLabel for="data"
								value="Data: " title="data" />
						</h:column>
						<h:column>
							<rich:calendar styleClass="contractRich"
								label="Data"
								value="#{requisicaoView.requisicaoPesquisa.dataReqisicao}"
								datePattern="dd/MM/yyyy" enableManualInput="true"
								oninputkeyup="formataMascara('##/##/####', this)"
								oninputchange="formataMascara('##/##/####', this)"
								maxlength="10">
							</rich:calendar>
						</h:column>
						
						<h:column>
							<h:outputLabel for="justificativa" value="Justificativa: " />
						</h:column>

						<h:column>
							<h:inputText styleClass="inputContrast"
								value="#{requisicaoView.requisicaoPesquisa.justificativa}" name="justificativa"
								id="justificativa" type="text" size="10" maxlength="10"></h:inputText>
						</h:column>
						
						<h:column>
							<h:outputLabel for="status" value="Status: " />
						</h:column>
						<h:column>
							<h:selectOneMenu styleClass="inputContrast" name="status"
								id="status"	value="#{requisicaoView.requisicaoPesquisa.statusRequisicao}" label="Tipo">
								<f:selectItem itemLabel="- Selecione -"/>
								<f:selectItems value="#{requisicaoView.listaStatusReq}" />
							</h:selectOneMenu>
						</h:column>
					</h:panelGrid>


					<br />

					<table border="1" width="35%" align="left">
						<tr>
							<td><h:commandButton action="#{requisicaoView.pesquisar}"
									value="  Pesquisar  "></h:commandButton></td>
							<td><a4j:commandButton action="#{requisicaoView.iniciar}"
									immediate="true" value="   Limpar   " render="formBem" /></td>
							<td><h:commandButton action="#{requisicaoView.novo}"
									value="    Novo    "></h:commandButton></td>
						</tr>

					</table>

				</fieldset>

				<br />

				<a4j:outputPanel id="outPutPanelListaBem">

					<fieldset>

						<div style="overflow: auto;">
							<div align="center">
								<h:outputText
									rendered="#{requisicaoView.exibeMsgNenhumRegistroEncontrado}"
									value="Nenhum registro encontrado." />
							</div>
							<h:dataTable id="TabelaProgramas"
								rendered="#{not empty requisicaoView.listaRequisicao}"
								value="#{requisicaoView.listaRequisicao}" var="requisicao" width="100%"
								headerClass="tbhead">
								<h:column>
									<f:facet name="header">
										<h:outputText value="Status" />
									</f:facet>

									<div align="center">
										<h:commandLink action="#{requisicaoView.detalhar}" value="#{requisicao.descStatusRequisicao}">
											<f:setPropertyActionListener target="#{requisicaoView.requisicao}"	value="#{requisicao}" />
										</h:commandLink>
									</div>
								</h:column>
								
								<h:column>
									<f:facet name="header">
										<h:outputText value="N&ordm; do Pedido" />
									</f:facet>

									<div align="center">
										#{requisicao.codigo}
									</div>
								</h:column>

								<h:column>
									<f:facet name="header">
										<h:outputText value="Tipo do Patrimonio" />
									</f:facet>
									
									<div align="center">
										#{requisicao.descTipoPatrimonio}
									</div>
								</h:column>
								
								<h:column>
									<f:facet name="header">
										<h:outputText value="Setor" />
									</f:facet>
									
									<div align="center">
										#{requisicao.usuario.setor.nomeSetor}
									</div>
								</h:column>

								<h:column>
									<f:facet name="header">
										<h:outputText value="Alterar" />
									</f:facet>

									<div align="center">
										<h:commandLink action="#{requisicaoView.editar}">
											<h:graphicImage value="" alt="Alterar"
												url="../images/editar.jpg" height="20px" width="20px" />
											<f:setPropertyActionListener target="#{requisicaoView.requisicao}"
												value="#{requisicao}" />
										</h:commandLink>
									</div>

								</h:column>
								<h:column>
									<f:facet name="header">
										<h:outputText value="Excluir" />
									</f:facet>

									<div align="center">
										<a4j:commandLink action="#{requisicaoView.popupExcluir}" >
											<h:graphicImage value="" alt="Excluir"
												url="../images/excluir.jpg" height="20px" width="20px" />
											<f:setPropertyActionListener target="#{requisicaoView.requisicao}"
												value="#{requisicao}" />
										</a4j:commandLink>
									</div>
								</h:column>
							</h:dataTable>

						</div>

					</fieldset>

				</a4j:outputPanel>


			</div>
			<apabb:popupConfirmacao componentView="#{requisicaoView}"
				form="formBem" />
		</h:form>

	</ui:define>
</ui:composition>
